import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import qiankun from 'vite-plugin-qiankun'
import path from 'path'

const { name } = require('./package.json');

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    qiankun(name, {
      useDevMode: true
    })
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
    extensions: ['.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] // 确保包含.vue
  },
  server: {
    port: 4004,
    open: true,
    headers: {
      'access-control-allow-origin': '*'
    }
  }
})
